<?
define('BASEPATH', true);
require_once("../inc/config.php");
if(!$is_online){
	redirect('../index.php');
	exit;
}

$id = $db->EscapeString($_GET['id']);
$type = $db->EscapeString($_GET['t']);

if($type == 'p'){
$sql = $db->Query("SELECT * FROM `p_pack` WHERE `id`='".$id."'");
$pack = $db->FetchArray($sql);
if($pack['id'] == ''){
	redirect('../index.php');
	exit;
}
?>
<html><title>Redirecting...</title><body onload="form1.submit()">
<form name="form1" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<?=$site['paypal']?>">
<input type="hidden" name="item_name" value="<?=$pack['name']?>">
<input type="hidden" name="item_number" value="<?=$pack['days']?>">
<input type="hidden" name="custom" value="<?=$data['id']?>">
<input type="hidden" name="amount" value="<?=$pack['price']?>">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="return" value="<?=$site['site_url']?>">
<input type="hidden" name="cancel_return" value="<?=$site['site_url']?>">
<input type="hidden" name="notify_url" value="<?=$site['site_url']?>/inc/ipn/p_ipn.php">
</form>
<?
}elseif($type == 'c'){
$sql = $db->Query("SELECT * FROM `c_pack` WHERE `id`='".$id."'");
$pack = $db->FetchArray($sql);
if($pack['id'] == ''){
	redirect('../index.php');
	exit;
}
?>
<html><title>Redirecting...</title><body onload="form2.submit()">
<form name="form2" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<?=$site['paypal']?>">
<input type="hidden" name="item_name" value="<?=$pack['name']?>">
<input type="hidden" name="item_number" value="<?=$pack['coins']?>">
<input type="hidden" name="custom" value="<?=$data['id']?>">
<input type="hidden" name="amount" value="<?=$pack['price']?>">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="return" value="<?=$site['site_url']?>">
<input type="hidden" name="cancel_return" value="<?=$site['site_url']?>">
<input type="hidden" name="notify_url" value="<?=$site['site_url']?>/inc/ipn/c_ipn.php">
</form>
<?
}else{
	redirect('../index.php');
	exit;
}?>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h3 align="center">Please wait while we transfer you to Paypal.</h3><body>
</html>
